package tr.edu.ege.communicator;

import java.io.Serializable;

/**
 * Includes the content to be sent to the destination and reciever address of
 * the message.
 * 
 * @author Onur ULUSU
 * 
 */
public class Message implements Serializable {

	private static final long serialVersionUID = 5761140248421757539L;

	/**
	 * The content of the message.
	 */
	private String content;

	/**
	 * Receiver of this message.
	 */
	private Address reciever;

	/**
	 * Owner of this message..
	 */
	private Address sender;

	/**
	 * Type of this message. It can vary with the application which uses this
	 * communication middleware.
	 */
	private int messageType;

	/**
	 * @return the envelope
	 */
	public Address getReciever() {
		return reciever;
	}

	/**
	 * @param reciever
	 *            the envelope to set
	 */
	public void setReciever(Address reciever) {
		this.reciever = reciever;
	}

	/**
	 * @param content
	 *            the content to set
	 */
	public void setContent(String content) {
		this.content = content;
	}

	/**
	 * @return the content
	 */
	public String getContent() {
		return content;
	}

	@Override
	public String toString() {
		return reciever.toString() + "\n" + "Content : " + content;
	}

	/**
	 * @param messageType
	 *            the messageType to set
	 */
	public void setMessageType(int messageType) {
		this.messageType = messageType;
	}

	/**
	 * @return the messageType
	 */
	public int getMessageType() {
		return messageType;
	}

	/**
	 * @param sender the sender to set
	 */
	public void setSender(Address sender) {
		this.sender = sender;
	}

	/**
	 * @return the sender
	 */
	public Address getSender() {
		return sender;
	}
}
